<?php

/*
	info: 获取首页图片
*/

define('NOT_HTMLPAGE', TRUE);
require './common.inc.php';

$webglobal['datainfo'] = $db->GetOne("SELECT * FROM promotion ORDER BY id DESC LIMIT 0,1");

if (!empty($webglobal['datainfo']))
{
	$curusefile = WEBFILEPATH."/files/{$webglobal['datainfo']['gifpic']}";
	include_once WEBFILEPATH.'/include/image.class.php';
	$image = new Image($curusefile);
	$image->DoInit();
	$image->ShowFile(strtoupper(global_FileExt($curusefile)));
	$image->Destroy();
	if (!empty($image->errorMsg))
	{
		api_showimage_Error();
	}
	exit();
}
else
{
	api_showimage_Error();
}

function api_showimage_Error()
{
	header("HTTP/1.0 404 Not Found");
	exit();
}
